#include <stdio.h>
#include <float.h>

#define ARG0_0  ((-1) * LDBL_MAX)
#define ARG0_1  LDBL_MAX
#define ARG0_2  2.333333L

#define ARG1_0  ((-1) * LDBL_MAX)
#define ARG1_1  LDBL_MAX
#define ARG1_2  (-4.145213L)

int TEST(long double x, long double y, int exp)
{
    int res = __builtin_isgreater (x, y);
    if (res != exp) {
        printf("Error: expect result is %d, but actual result is %d.\n", exp, res);
        return 1;
    }
    return 0;
}

int main()
{
    int ret = 0;
    ret += TEST(ARG0_0, ARG1_0, 0);
    ret += TEST(ARG0_0, ARG1_1, 0);
    ret += TEST(ARG0_0, ARG1_2, 0);

    ret += TEST(ARG0_1, ARG1_0, 1);
    ret += TEST(ARG0_1, ARG1_1, 0);
    ret += TEST(ARG0_1, ARG1_2, 1);

    ret += TEST(ARG0_2, ARG1_0, 1);
    ret += TEST(ARG0_2, ARG1_1, 0);
    ret += TEST(ARG0_2, ARG1_2, 1);
    return ret;
}
